import Vue from 'vue'
import App from './App'
import cuCustom from './colorui/components/cu-custom.vue'
import moment from "moment"
import user from "utils/user.js" 
import common from "utils/common.js"
import login from "utils/login.js"  
import adUtil from "./utils/adUtil.js"
import api from "./api/api.js"

Vue.config.productionTip = false
App.mpType = 'app'

Vue.component('cu-custom',cuCustom)

uni.$common = common
uni.$login = login
uni.$user = user
uni.$adUtil = adUtil
uni.$moment = moment
uni.$api = api
Vue.prototype.$api = api

uni.getSystemInfo({
	success: (e)=> {
		// #ifndef MP
		Vue.prototype.StatusBar = e.statusBarHeight;
		if (e.platform == 'android') {
			Vue.prototype.CustomBar = e.statusBarHeight + 50;
		} else {
			Vue.prototype.CustomBar = e.statusBarHeight + 45;
		};
		// #endif
		
		// #ifdef MP-WEIXIN || MP-QQ
			Vue.prototype.StatusBar = e.statusBarHeight;
			let capsule = wx.getMenuButtonBoundingClientRect();
			if (capsule) {
				Vue.prototype.Custom = capsule;
				// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
				Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
			} else {
				Vue.prototype.CustomBar = e.statusBarHeight + 50;
			}
		// #endif		
			
		
		// #ifdef MP-ALIPAY
			Vue.prototype.StatusBar = e.statusBarHeight;
			Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
		// #endif
	}
})
			
const app = new Vue({
    ...App
})
app.$mount()

export default app